import { httpGet, httpPost } from '@/utils/http'

/**
 * 获取购物车列表
 * @param game_id
 * @param area_id
 */
export const getCartListApi = (data) => {
  return httpPost('/shop/cart/cart_list', data)
}

/**
 * 加入购物车
 * @param game_id
 * @param area_id
 * @param sku
 * @param num
 */
export const addCartApi = (data) => {
  return httpPost('/shop/cart/add', data)
}

/**
 * 删除购物车
 * @param id
 */
export const delCartApi = (data) => {
  return httpPost('/shop/cart/del', data)
}

/**
 * 编辑购物车
 * @param id
 * @param num
 */
export const editCartApi = (data) => {
  return httpPost('/shop/cart/edit', data)
}
/**
 * 校验优惠码
 * @param discount_code  优惠码
 */
export const checkDiscountCodeApi = (data) => {
  return httpPost('/shop/cart/verify_discount_code', data)
}

/**
 * 订单详情
 * @param order_sn
 * @param email
 */
export const getOrderDetailApi = (data) => {
  return httpPost('/shop/transport/order_detail', data)
}

/**
 * 确认订单页面
 * @param game_id
 * @param area_id
 * @param use_integral  是否用金币抵扣1是0否
 * @param pay_type
 * @param note  备注
 * @param sku_details [{goods_item_id: 1, num: 1, is_gifts: 0}] 是否是礼品：0否1是
 */
export const getConfirmOrderPageApi = (data) => {
  return httpPost('/shop/order/confirm_order_page', data)
}

/**
 * 获取礼品商品
 * @param game_id
 * @param area_id
 * @param order_total
 */
export const getGiftsGoodsApi = (data) => {
  return httpPost('/shop/order/get_gifts_goods', data)
}

/**
 * 提交订单
 * @param game_id
 * @param area_id
 * @param use_integral  是否用金币抵扣1是0否
 * @param pay_type 支付方式
 * @param account  账号
 * @param email  邮箱
 * @param first_name  名
 * @param last_name  姓
 * @param platform  平台
 * @param note  备注
 * @param discount_code  优惠码
 * @param sku_details [{goods_item_id: 1, num: 1, is_gifts: 0}] 是否是礼品：0否1是
 */
export const submitOrderApi = (data) => {
  return httpPost('/shop/order/confirm_order', data)
}

/**
 * 订单完成
 * @param order_id 订单id
 */
export const orderCompleteApi = (data) => {
  return httpPost('/shop/transport/complete_order', data)
}

/**
 * 金币支付
 * @param pay_type
 * @param target
 * @param target_type orderall
 * @param pay [{pay_type: '', money: ''}]
 */
export const integralPayApi = (data) => {
  return httpPost('/payment/pay/pay', data)
}
